package net.qiqbframework.modelling.domain;

import java.util.Collections;
import java.util.Map;
import java.util.Optional;
import java.util.Set;

/**
 * {@link AggregateModel} 工厂
 */
public interface AggregateModelFactory {


    default <T> AggregateModel<T> createModel(Class<? extends T> aggregateType) {
        return createModel(aggregateType, Collections.emptySet());
    }

    /**
     * 根据类型创建聚合模型
     *
     * @param aggregateType 聚合类型
     * @param subtypes      聚合子类型
     * @param <T>
     * @return
     */
    <T> AggregateModel<T> createModel(Class<? extends T> aggregateType, Set<Class<? extends T>> subtypes);


    <T> Optional<AggregateModel<T>> getModel(String aggregateNaming);
    <T> Optional<AggregateModel<T>> getModel(Class<T> aggregateRootType);

    Set<String> getAllAggregateNaming();

}
